using GalaSoft.MvvmLight.Messaging;
using SfdClient.Messaging;

namespace SfdClient.ViewModel
{
    public class BrowserViewModel : WorkingViewModelBase
    {
        public BrowserViewModel()
        {
            if (!IsInDesignMode)
            {
                Messenger.Default.Register<CurrentProjectChangedMessage>(this,
                                                                         message =>
                                                                             {
                                                                                 ProjectFriendlyName =
                                                                                     message.Project.FriendlyName;

                                                                             });
            }
        }

        #region ProjectFriendlyName Property

        /// <summary>
        /// The <see cref="ProjectFriendlyName" /> property's name.
        /// </summary>
        public const string ProjectFriendlyNamePropertyName = "ProjectFriendlyName";

        private string _projectFriendlyName;

        public string ProjectFriendlyName
        {
            get { return this._projectFriendlyName; }

            private set
            {
                if (this._projectFriendlyName == value) return;

                this._projectFriendlyName = value;
                RaisePropertyChanged(ProjectFriendlyNamePropertyName);
            }
        }

        #endregion  
    }
}